package com.jacky.dubbo3.provider;

import com.jacky.dubbo3.api.IOrderService;
import com.jacky.dubbo3.api.IUserService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.rpc.RpcContext;

import java.util.Map;
import java.util.UUID;

@DubboService
public class GrayUserServiceImpl implements IUserService {

    @DubboReference(check = false)
    private IOrderService orderService;

    @Override
    public String getUserInfo() {
        Map<String, String> attachments = RpcContext.getClientAttachment().getAttachments();
        String orderDetail = orderService.getOrderDetail(UUID.randomUUID().toString().replace("-", "").toUpperCase());
        System.out.println("--- order detail:" + orderDetail);
        return "user info from gray user service";
    }
}
